package com.jman.resident.controller;

import com.jman.resident.domain.Resident;
import com.jman.resident.dto.PageBean;
import com.jman.resident.dto.PageInfo;
import com.jman.resident.service.impl.ResidentServiceImpl;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/resident")
public class ResidentController {
    @Resource
    private ResidentServiceImpl residentService;

    @PostMapping("/getPage")
    public PageBean<Resident> getInfoByPage(@RequestBody PageInfo pageInfo){
        return residentService.getInfoByPage(pageInfo);
    }

    @PutMapping("/putInfo")
    public Boolean updateResident(@RequestBody Resident resident){
        return residentService.updateById(resident);
    }

    @DeleteMapping("/delInfo/{id}")
    public Boolean deleteById(@RequestParam Integer id){
        return residentService.removeById(id);
    }
}
